import requests
def get_xinB(day):
    res = requests.post('https://gw.newrank.cn/api/bili/nr/bili/search/keywordsSearch', 
        headers={
        'accept': 'application/json, text/plain, */*',
        'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,ja;q=0.7',
        'content-type': 'application/json;charset=UTF-8',
        'n-token': '31f3228c613044beb5281dc35e3cc126',
        # 'sec-ch-ua': ''Google Chrome';v='113', 'Chromium';v='113', 'Not-A.Brand';v='24''
        'sec-ch-ua-mobile': '?0',
        'sec-ch-ua-platform': 'macOS',
        'sec-fetch-dest': 'empty',
        'sec-fetch-mode': 'cors',
        'sec-fetch-site': 'same-site',
        'cookie': "sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%22nr_1300ddi3x%22%2C%22first_id%22%3A%2218924db0cdec7-0db19ea82365c48-1c525634-1296000-18924db0cdf1eb3%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%2C%22%24latest_referrer%22%3A%22%22%7D%2C%22%24device_id%22%3A%2218924db0cdec7-0db19ea82365c48-1c525634-1296000-18924db0cdf1eb3%22%7D; acw_tc=76b20f6416894970468037941e6ff645ea15e3e0ba11d2e86b7b7e948c56dd; token=6249F2123F554546899405E507DD430C; NR_MAIN_SOURCE_RECORD={'locationSearch':'','locationHref':'https://xz.newrank.cn/monitor/volumeQuery','referrer':'https://xz.newrank.cn/material/video'}",
        'Referer': 'https://xz.newrank.cn/',
        'Referrer-Policy': 'strict-origin-when-cross-origin'
        },
        json= {'keywordsVideoRequestList':
            [{'endTime':'','startTime':'','timeType':f'{day}d','input':{'type':'title'},'must':['《天道》'],'should':['《天道》','王志文','丁元英','小丹'],'mustNot':['修','游戏','漫画','修仙','火影','忍者','轮回','神','酬勤']}]},
    )
    resj = res.json()
    return resj['data'][0]
import json
    # print(getComment(urlMovieReview))
json.dump(get_xinB(30), open('src/data/xinBday.json', 'w', encoding='utf-8'), ensure_ascii=False)
